package cn.mrlong.base.extensions

/**
 * 作者：BINGO
 * 时间：2021/03/29 10:40
 */
/**
 * 判断字符串等于null / length = 0 / 等于“”
 * @receiver String.Companion
 * @param string String
 * @return Boolean
 */
fun String.Companion.isBlank(string: String?): Boolean {
    return null == string || string.trim().isEmpty() || "".equals(string)
}

/**
 * 判断字符串等于null / length = 0 / 等于“”/等于“null”
 * @receiver String.Companion
 * @param string String
 * @return Boolean
 */
fun String.Companion.isBlackAndNull(string: String?): Boolean {
    return isBlank(string) || "null".equals(string)
}

/**
 * 判断字符串不等于null / length ！= 0 / 不等于“”
 * @receiver String.Companion
 * @param string String
 * @return Boolean
 */
fun String.Companion.isNotBlank(string: String?): Boolean {
    return !isBlank(string)
}

/**
 * 判断字符串不等于null / length ！= 0 / 不等于“”/不等于“null”
 * @receiver String.Companion
 * @param string String
 * @return Boolean
 */
fun String.Companion.isNotBackAndNotNull(string: String?): Boolean {
    return !isBlackAndNull(string)
}